{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/lawbda/env/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import os\n",
    "import pickle\n",
    "import sklearn"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "# Batch size = 2, sequence length = 3, number features = 1, shape=(2, 3, 1)\n",
    "values231 = np.array([\n",
    "\t[[1], [2], [3]],\n",
    "\t[[2], [3], [4]]\n",
    "])\n",
    "\n",
    "# Batch size = 3, sequence length = 5, number features = 2, shape=(3, 5, 2)\n",
    "values352 = np.array([\n",
    "\t[[1, 4], [2, 5], [3, 6], [4, 7], [5, 8]],\n",
    "\t[[2, 5], [3, 6], [4, 7], [5, 8], [6, 9]],\n",
    "\t[[3, 6], [4, 7], [5, 8], [6, 9], [7, 10]]\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Tensor(\"rnn/transpose:0\", shape=(2, 3, 100), dtype=float32)\n",
      "Tensor(\"rnn/while/Exit_2:0\", shape=(2, 100), dtype=float32)\n"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "tf.reset_default_graph()\n",
    "\n",
    "tf_values231 = tf.constant(values231, dtype=tf.float32)\n",
    "lstm_cell = tf.contrib.rnn.BasicRNNCell(num_units=100)\n",
    "outputs, state = tf.nn.dynamic_rnn(cell=lstm_cell, dtype=tf.float32, inputs=tf_values231)\n",
    "\n",
    "print(outputs)\n",
    "# tf.Tensor 'rnn_3/transpose:0' shape=(2, 3, 100) dtype=float32\n",
    "print(state)\n",
    "\n",
    "with tf.Session() as sess:\n",
    "    sess.run(tf.global_variables_initializer())\n",
    "    output_run, state_run = sess.run([outputs, state])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
